/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package py.una.pol.tesis.ii.util;

/**
 *
 * @author leandro
 */
import javax.servlet.ServletContext;  
import javax.servlet.ServletContextEvent;  
import javax.servlet.ServletContextListener;  
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
  
public class ContextListener implements ServletContextListener {  
  
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        
        ServletContext servletContext = sce.getServletContext();
        String rootPath = servletContext.getRealPath("/");        
        String log4jFile = servletContext.getInitParameter("log4jConf");        
        String propertyLog = rootPath + log4jFile;
        
        PropertyConfigurator.configure(propertyLog);
//        Logger.getLogger("").info("EmergenciasWAR Inicializado..");

    }     
    @Override
    public void contextDestroyed(ServletContextEvent arg0) {
//        Logger.getLogger("").info("EmergenciasWAR ha finalizado..");
    }  
  
}  
